package com.itheima.features.optional.demo01;

import java.util.Optional;

public class OptionalDemo02 {

    public static void main(String[] args) {

        Student student = null;//new Student("蓝湛", 15);

//        Optional<Student> optionalStudent = Optional.of(student);
//        System.out.println(optionalStudent);

        Optional<Student> optionalStudent = Optional.ofNullable(student);
        System.out.println(optionalStudent);

        System.out.println(optionalStudent.isPresent());

        Student student1 = optionalStudent.get();
        System.out.println(student1);
    }
}
